package org.simple.framework.html.parser.convert.converter;

import org.simple.framework.html.parser.convert.TypeConverter;

/**
 * 项目名称：simple-framework
 * 类名称：ByteConverter
 * 类描述：ByteConverter
 * 创建时间：2018/9/25
 *
 * @author sisyphus   (E-mail:1620657419@qq.com)
 * @version v1.0
 */
public class ByteConverter implements TypeConverter {

    @Override
    public boolean isSupported(Class clazz) {
        return Byte.class.isAssignableFrom(clazz) || byte.class.isAssignableFrom(clazz);
    }

    @Override
    public Byte convert(Object o, Class clazz) {
        return o == null ? null : Byte.valueOf((String) o);
    }

}
